<?php
	function check_buoi($str)
	{
		if($str == 's')
			return 1;
		if($str == 'c')
			return 2;
		if($str == 't')
			return 3;
	}
	
	function check_group($mon1, $mon2)
	{
		$r1 = mysql_fetch_array(mysql_query(" SELECT group_id,name FROM group_detail a join groups b on a.group_id = b.id WHERE subject = '{$mon1}'  "));
		$r2 = mysql_fetch_array(mysql_query(" SELECT group_id,name FROM group_detail a join groups b on a.group_id = b.id WHERE subject = '{$mon2}'  "));	
		if($r1['group_id'] == $r2['group_id'])
			return true;
		if(($r1['name'] == 'A' && $r2['name'] == 'B') || ($r1['name'] == 'B' && $r2['name'] == 'A') || 
				($r1['name'] == 'C' && $r2['name'] == 'D') || ($r1['name'] == 'D' && $r2['name'] == 'C'))
			return true;
		return false;
	}
?>